<template>
  <div class="list" ref="wrapper">
    <div>
      <div class="area">
        <div class="area-title border-topbottom">当前城市</div>
        <div class="btn-list">
          <div class="btn-wrapper">
            <div class="btn">北京</div>
          </div>
        </div>
      </div>
      <div class="area">
        <div class="area-title border-topbottom">热门城市</div>
        <div class="btn-list">
          <div class="btn-wrapper" v-for="city of hotCitys" :key="city.id">
            <div class="btn">{{city.name}}</div>
          </div>
        </div>
      </div>
      <div class="area" v-for="(cityitems, key) of citys" :key="key">
        <div class="area-title border-topbottom">{{key}}</div>
        <div class="city-list" v-for="cityitem of cityitems" :key="cityitem.id">
          <div class="city-item border-bottom" >{{cityitem.name}}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import BScroll from 'better-scroll'
export default {
  name: 'CityList',
  props: {
    hotCitys: Array,
    citys: Object
  },
  mounted () {
    this.scroll = new BScroll(this.$refs.wrapper)
  }
}
</script>

<style lang="stylus" scoped>
  @import "~styles/var.styl"
  .border-topbottom
    &:before
      border-color #ccc
    &:after
      border-color #ccc
  .list
    overflow hidden
    position absolute
    top 1.60rem
    left 0
    right 0
    bottom 0
    .area-title
      background #eee
      padding-left .2rem
      line-height .44rem
      font-size .26rem
      color: #666
    .btn-list
      overflow hidden
      padding: .1rem .6rem .1rem .1rem
      .btn
        border #ccc solid .02rem
        float left
        border-radius .06rem
        width 27%
        text-align center
        margin .1rem
    .city-list
      padding-left .2rem
      .city-item
        padding-top: .2rem
        line-height .50rem
      .border-bottom
        &:break-before
          border-color #ccc
</style>
